package com.example.demo.pattern.commandpattern;

import com.example.demo.pattern.commandpattern.command.Light;
import com.example.demo.pattern.commandpattern.command.LightOnCommand;
import com.example.demo.pattern.commandpattern.control.SimpleRemoteControl;

public class Start {
    public static void main(String[] args) {
        //简单就如此演示吧，核心就是用Command代理具体类的功能（如Light.on()）
        //后面还实现了撤销功能，给command实现undo方法（没有神奇的方式，就是手动调用如Light.off()）。调用command时记录，撤销时调用其undo
        SimpleRemoteControl simpleRemoteControl = new SimpleRemoteControl();
        LightOnCommand lightOnCommand = new LightOnCommand(new Light());
        lightOnCommand.execute();
    }
}
